package com.xiaozhi.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xiaozhi.dao.WxOrderMapper;
import com.xiaozhi.entity.WxOrder;
import com.xiaozhi.service.WxOrderServer;

import lombok.AllArgsConstructor;

@Service
@AllArgsConstructor
public class WxOrderServerImpl implements WxOrderServer{
    private final WxOrderMapper wxOrderMapper;

    @Override
    @Transactional
    public int add(WxOrder order)
    {
        return wxOrderMapper.add(order);
    }

    /*
     * 更新订单字段
    */
    @Override
    @Transactional
    public int update(WxOrder order)
    {
        return wxOrderMapper.update(order);
    }

    /*
     * 通过orderId 查找订单信息
     */
    @Override
    @Transactional
    public WxOrder selectOrderByorderId(String orderId)
    {
        return wxOrderMapper.selectOederByOrderId(orderId);
    }

    /*
        * 根据userId 查询订单
        */
    @Override
    @Transactional
    public List<WxOrder> selectOrderByuserId(String userId)
    {
        return wxOrderMapper.selectOrderByuserId(userId);
    }
}
